local wen__jinjin_active = fk.CreateSkill({
  name = "wen__jinjin_active&",
})

Fk:loadTranslationTable{
  ["wen__jinjin_active&"] = "进金",
  [":wen__jinjin_active&"] = "出牌阶段限一次，你可以将至多两张牌交给瓦伦蒂娜。",

  ["#sy__jinjin"] = "进金：将至多两张牌交给瓦伦蒂娜",
}

wen__jinjin_active:addEffect("active", {
  anim_type = "support",
  prompt = "#sy__jinjin",
  mute = true,
  min_card_num = 1,
  max_card_num = 2,
  target_num = 0,
  can_use = function(self, player)
    if player:usedSkillTimes(wen__jinjin_active.name, Player.HistoryPhase) < 1 then
      return table.find(Fk:currentRoom().alive_players, function(p) 
        return p:hasSkill("sy__jinjin") and p ~= player 
      end)
    end
    return false
  end,
  card_filter = function(self, player, to_select, selected)

    local area = Fk:currentRoom():getCardArea(to_select)
    return #selected < 2 and (area == Player.Hand or area == Player.Equip)
  end,
  on_use = function(self, room, effect)
    local player = effect.from

    local targets = table.filter(room.alive_players, function(p)
      return p:hasSkill("sy__jinjin") and p ~= player
    end)

    local target
    if #targets == 1 then
      target = targets[1]
    else
      target = room:askToChoosePlayers(player, {
        min_num = 1,
        max_num = 1,
        targets = targets,
        skill_name = "wen__jinjin_active&",
        prompt = "#sy__jinjin",
        cancelable = false,
      })[1]
    end

    if not target then return end

    room:notifySkillInvoked(target, "sy__jinjin")
    target:broadcastSkillInvoke("sy__jinjin")
    room:doIndicate(player.id, { target.id })

    room:moveCardTo(effect.cards, Player.Hand, target, fk.ReasonGive, "wen__jinjin_active&", nil, true, player)
  end,
})

return wen__jinjin_active